package utils

import (
	"fmt"
	"gopkg.in/ini.v1"
)

var(
	AppMode string
	HttpPort string

	Db string
	DbHost string
	DbPort string
	DbUser string
	DbPassWord string
	DbName string
)
func init(){
	cfg,err:= ini.Load("config/config.ini")
	if err!=nil{
		fmt.Println("配置文件读取错误",err)

	}
	LoadServer(cfg)
	LoadData(cfg)
}

func LoadServer(file *ini.File){
	AppMode = file.Section("server").Key("AppMode").MustString("debug")
	HttpPort = file.Section("server").Key("HttpPort").MustString("3000")
}
func LoadData(file *ini.File){
	Db = file.Section("server").Key("Db").MustString("mysql")
	DbHost = file.Section("server").Key("DbHost").MustString("3000")
	DbPort = file.Section("server").Key("DbPort").MustString("3306")
	DbPassWord = file.Section("server").Key("DbPassWord").MustString("admin123")
	DbName = file.Section("server").Key("DbName").MustString("ginblog")
	DbUser = file.Section("server").Key("DbUser").MustString("lpb")



}